const express = require('express')
const UserRouter = express.Router()
const UserController = require('../controllers/UserController.js')

const multer = require('multer')
const upload = multer({ dest: 'public/avataruploads/' })

UserRouter.post('/api/user/login', UserController.login)
// UserRouter.get('/api/user/home', (req, res) => {
//   res.send({ ok: 1 })
// })
UserRouter.post('/api/user/upload', upload.single('file'), UserController.upload)
UserRouter.post('/api/user/add', upload.single('file'), UserController.add)
UserRouter.get('/api/user/list', UserController.getList)
UserRouter.delete('/api/user/list/:id', UserController.delList)
UserRouter.get('/api/user/list/:id', UserController.getList)
UserRouter.put('/api/user/list/:id', UserController.putList)
UserRouter.get('/api/user/getteacherlist', UserController.getTeacherList)
UserRouter.get('/api/user/getstudentlist', UserController.getStudentList)
UserRouter.get('/api/user/total', UserController.getTotal)
UserRouter.get('/api/user/studenttotal', UserController.getStudentTotal)

module.exports = UserRouter
